/**
 * 
 */
package testsrc;

import java.util.Date;
import java.util.List;

import com.wfe.generics.BussinessTask;
import com.wfe.mapping.client.WfContextAttribute;

/**
 * @author kareem_yehya
 * @since 02 April 2009 <br>
 *        Test Class for Bussiness Task functionality
 * @version 1.0.0.1
 * */

public class TestBussinessTask extends BussinessTask
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{

		TestBussinessTask test = new TestBussinessTask();
		test.execute();

	}

	@Override
	public void execute()
	{

		System.out.println("Start Execution Task TestBussinessTask at " + new Date());

		// *************************** load dummy task
		loadDummyTask(4l);

		// *************************** list all attributes for task one
		List<WfContextAttribute> attributeList = getWfContextAttributeList();
		if(attributeList != null)
		{
			System.out.println("Attribute List Size Is = " + attributeList.size());
			for(WfContextAttribute attribute : attributeList)
			{
				System.out.println("Attribute Name Is = " + attribute.getAttributeName());
				System.out.println("Attribute Name Is = " + attribute.getAttributeValue());

			}

		}

		// ********************** add attribute

		this.addContextAttribute("PDF ID1", "10000001");
		this.addContextAttribute("PDF ID2", "10000002");
		this.addContextAttribute("PDF ID3", "10000003");
		this.addContextAttribute("PDF ID4", "10000004");
		this.addContextAttribute("PDF ID5", "10000005");
		this.addContextAttribute("PDF ID6", "10000006");
		this.addContextAttribute("PDF ID7", "10000007");
		this.addContextAttribute("PDF ID8", "10000008");
		this.addContextAttribute("PDF ID9", "10000001");
		this.addContextAttribute("PDF ID10", "10000002");
		this.addContextAttribute("PDF ID11", "10000003");
		this.addContextAttribute("PDF ID12", "10000004");
		this.addContextAttribute("PDF ID13", "10000005");
		this.addContextAttribute("PDF ID14", "10000006");
		this.addContextAttribute("PDF ID15", "10000007");
		this.addContextAttribute("PDF ID16", "10000008");
		// ******************************************** update attribute

		this.updateContextAttribute("PDF ID1", "changed");
		this.updateContextAttribute("PDF ID2", "changed");
		this.updateContextAttribute("PDF ID3", "changed");
		this.updateContextAttribute("PDF ID4", "changed");
		this.updateContextAttribute("PDF ID5", "changed");
		this.updateContextAttribute("PDF ID6", "changed");
		this.updateContextAttribute("PDF ID7", "changed");
		this.updateContextAttribute("PDF ID8", "changed");
		this.updateContextAttribute("PDF ID1", "changed again");
		this.updateContextAttribute("PDF ID2", "changed again");

		// ********************* change task status
		taskFailed();
		taskSuccess();
		taskFailed();
		taskFailed();

		// *************************** list all attributes for task one
		List<WfContextAttribute> attributeList2 = getWfContextAttributeList();
		if(attributeList2 != null)
		{
			System.out.println("Attribute List Size Is = " + attributeList2.size());
			for(WfContextAttribute attribute : attributeList2)
			{
				System.out.println("Attribute Name Is = " + attribute.getAttributeName());
				System.out.println("Attribute Value Is = " + attribute.getAttributeValue());

			}

		}

		// ********************** add attribute
		System.out.println("End Execution Task TestBussinessTask at " + new Date());
	}
}
